<div class="tmd-doc">
<p></p>
<h1 class="tmd-header-1">
const 1
</h1>
<p></p>
<div id="question" class="tmd-base">
<div class="tmd-usual">
What does the following program print?
</div>
<p></p>
<pre class="tmd-code line-numbers">
<code class="language-go">package main

const (
	_    = 6
	A, _ = iota, iota + 10
	_, _
	_, B
)

func main() {
	println(A, B)
}
</code></pre>
</div>
<p></p>
<div class="tmd-usual">
Choices:
</div>
<p></p>
<input type="radio" id="choiceA" name="choice" class="choice">
<input type="radio" id="choiceB" name="choice" class="choice">
<input type="radio" id="choiceC" name="choice" class="choice">
<input type="radio" id="choiceD" name="choice" class="choice">

<div id="choices">

<ul style="list-style-type:none;">
<li><label for="choiceA">0 15</label></li>
<li><label for="choiceB">1 15</label></li>
<li><label for="choiceC">0 13</label></li>
<li><label for="choiceD">1 13</label></li>
</ul>

</div><p></p>
<div id="answer" class="tmd-base">
<div class="tmd-usual">
Answer: 1 13
</div>
<p></p>
<div class="tmd-usual">
Run it on <a href="https://go.dev/play/p/J1dRQckPsvz">Go play</a>.
</div>
<p></p>
<div class="tmd-usual">
Key points:
</div>
<ul class="tmd-list">
<li class="tmd-list-item">
<div class="tmd-usual">
within a constant declaration, an omitted expression list in a constant specification is equivalent to repeating the list in the previous constant specification.
</div>
</li>
<li class="tmd-list-item">
<div class="tmd-usual">
the value of the prededeclared <code class="tmd-code-span">iota</code> is the constant specification order id (0-based) in a constant declaration.
</div>
</li>
</ul>
<p></p>
<div class="tmd-usual">
The constant declaration in the quiz code contains 4 constant specifications. By the just mentioned rules, the declaration is equivalent to the following one:
</div>
<p></p>
<pre class="tmd-code line-numbers">
<code class="language-go">const (
	_    = 6
	A, _ = 1, 1 + 10
	_, _ = 2, 2 + 10
	_, B = 3, 3 + 10
)
</code></pre>
<p></p>
</div>
<p></p>
</div>
